package com.mvp.shq.washer.ui.orderConfirm;

import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;

import com.jaeger.library.StatusBarUtil;
import com.mvp.shq.washer.R;
import com.mvp.shq.washer.base.BaseActivity;
import com.mvp.shq.washer.utils.T;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class OrderConfirmActivity extends BaseActivity<Presenter, Model> implements OrderConfirmConstract.View {

    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.img_washer)
    ImageView imgWasher;
    @BindView(R.id.tv_washer_name)
    TextView tvWasherName;
    @BindView(R.id.tv_address)
    TextView tvAddress;
    @BindView(R.id.tv_washer_no)
    TextView tvWasherNo;
    @BindView(R.id.tv_status)
    TextView tvStatus;
    @BindView(R.id.recyclerview)
    RecyclerView recyclerview;
    @BindView(R.id.rb_coupon_pay)
    RadioButton rbCouponPay;
    @BindView(R.id.rb_wallet_pay)
    RadioButton rbWalletPay;
    @BindView(R.id.rb_wx_pay)
    RadioButton rbWxPay;
    @BindView(R.id.rb_alipay_pay)
    RadioButton rbAlipayPay;
    private RadioButton[] rbs = new RadioButton[4];
    @Override
    public int getLayoutId() {
        return R.layout.activity_order_confirm;
    }

    @Override
    public void initView() {
        StatusBarUtil.setColor(this, ContextCompat.getColor(context, R.color.white), 0);
        title.setText("订单确认");
        rbs = new RadioButton[]{
                rbCouponPay,rbWalletPay,rbWxPay,rbAlipayPay
        };
        rbWxPay.setChecked(true);
        imageUtil.loadResImage(R.mipmap.order_pattern_select,imgWasher);
    }


    @OnClick({R.id.back, R.id.arl_coupon_pay, R.id.arl_wallet_pay, R.id.arl_wx_pay, R.id.arl_alipay_pay, R.id.btn_pay,R.id.rb_alipay_pay,
    R.id.rb_coupon_pay,R.id.rb_wallet_pay,R.id.rb_wx_pay})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back:
                finish();
                break;
            case R.id.arl_coupon_pay:
                setCheck(0);
                break;
            case R.id.rb_coupon_pay:
                setCheck(0);
                break;
            case R.id.arl_wallet_pay:
                setCheck(1);
                break;
            case R.id.rb_wallet_pay:
                setCheck(1);
                break;
            case R.id.arl_wx_pay:
                setCheck(2);
                break;
            case R.id.rb_wx_pay:
                setCheck(2);
                break;
            case R.id.arl_alipay_pay:
                setCheck(3);
                break;
            case R.id.rb_alipay_pay:
                setCheck(3);
                break;
            case R.id.btn_pay:
                break;
        }
    }

    private void setCheck(int position){
        for (int i=0;i<rbs.length;i++){
            rbs[i].setChecked(false);
        }
        rbs[position].setChecked(true);
    }
}
